<template>
  <div>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="printImg"
        >打印
        </el-button>
      </el-col>
    </el-row>
    <div id="export">
      <div v-for="(item,index) in candidateList2" style="float: left;">
        <table :key="index" border="0" cellspacing="0" cellpadding="0"
               style="width: 395px; height: 590px; border:solid #1e1e1e; border-width:1px 1px 1px 1px;">
          <tr>
            <td style="text-align: center">
              {{ yearN }}年初中毕业生体育考试
            </td>
          </tr>
          <tr>
            <td style="text-align: center">
              准考证
            </td>
          </tr>
          <tr>
            <td style="text-align: center"><img :src="imgBarcodeSrc(item.barCode)"/></td>
          </tr>
          <tr>
            <td>
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td style="text-align: right;width: 90px;">准考号：</td>
                  <td>{{ item.zkh }}</td>
                  <td rowspan="4" style="text-align: center"><img :src="item.zpStr"
                                                                  style="width: 130px;height: 175px"></img>
                  </td>
                </tr>
                <tr>
                  <td style="text-align: right">姓名：</td>
                  <td>{{ item.name }}</td>
                </tr>
                <tr>
                  <td style="text-align: right">性别：</td>
                  <td v-if="item.gender==1">男</td>
                  <td v-if="item.gender==2">女</td>
                </tr>
                <tr>
                  <td style="text-align: right">毕业学校：</td>
                  <td>{{ item.zxmc }}</td>
                </tr>
                <tr>
                  <td style="text-align: right">考试项目：</td>
                  <td colspan="4">
                    <table border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td style="text-align: right;width: 90px;">必考项目：</td>
                        <td>{{ item.bctyxm }}</td>
<!--                        <td>(满分15分)</td>-->
                      </tr>
                      <tr>
                        <td style="text-align: right;width: 90px;">选考项目：</td>
                        <td>{{ item.xctyxm1 }}</td>
                        <td>{{ item.xctyxm2 }}</td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td colspan="4" style="text-align: center">考试须知</td>
                </tr>
                <tr>
                  <td colspan="6">
                    <table border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td>1、</td>
                        <td colspan="3">考生在考前20分钟携带准考证到达考点的候考区等待查验；
                          进入考场服从裁判安排参加项目测试。
                        </td>
                      </tr>
                      <tr>
                        <td>2、</td>
                        <td colspan="3">考生参加考试自带运动鞋。</td>
                      </tr>
                      <tr>
                        <td>3、</td>
                        <td colspan="3">考生参加考试必须听从考务人员安排。</td>
                      </tr>
                      <tr>
                        <td>4、</td>
                        <td colspan="3">凭此证参加考试，准考证必须妥善保存。</td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>
<style>
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0.5em;
  color: rgba(0, 0, 0, .85);
  font-weight: 500;
}
</style>
<script>
import { printExcel } from '@/api/system/pointExcel'

export default {
  name: 'List',
  data() {
    return {
      candidateList2: [],
      yearN: 2021
    }
  },
  created() {
    console.log('页面加载')
    console.log(this.$route.query.data)
    this.candidateList2 = this.$route.query.data
    console.log(this.candidateList2)
    let nowDate = new Date()
    this.yearN = nowDate.getFullYear()
  },
  methods: {
    imgPhotoSrc(url) {
      return 'data:image/jpeg;base64,' + url
    },
    imgBarcodeSrc(url) {
      console.log(url)
      return 'data:image/jpeg;base64,' + url
    },
    //打印准考证
    printImg() {
      printExcel('export')
      // window.print()
    }
  }
}
</script>

<style scoped>

</style>
